<template>
  <div>
    <to-search></to-search>
    <van-card
      @click="$router.push({ name: '详情', params: { id: item.id } })"
      v-for="item in arr"
      :key="item.id"
      :price="item.price"
      :title="item.goodsname"
      :thumb="$pre + item.img"
    />

    <!-- 暂无数据  -->
    <van-empty v-if="arr.length == 0" description="暂无数据" />
  </div>
</template>

<script>
import { reqlist } from "../../http/http";
export default {
  data() {
    return {
      arr: []
    };
  },
  mounted() {
    reqlist({
      cateid: this.$route.query.id,
      type:this.$route.query.type?2:1
    }).then(res => {
      this.arr = res.data.list.goodData ? res.data.list.goodData : [];
    });
  }
};
</script>

<style scoped>
a {
  background: pink;
  margin: 1.3333vw;
  padding: 1.3333vw;
  border-radius: 1.3333vw;
  font-size: 6vw;
  display: flex;
}
a img {
  width: 20vw;
  height: 20vw;
}
a > div {
  flex: 1;
}
.null {
  text-align: center;
  font-size: 8vw;
}
</style>